﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace easyForm
{
    public static class Url
    {
        public static string Urlstr { get; set; }

        public static bool IsUrl(this string s)
        {
            if (!HasHttp(s))
            {
                s=AddHttp(s);
                if(!HasHttp(s))
                {
                    return false;
                }
            }
            Urlstr = s;
            return true;
        }

        private static bool HasHttp(string urlString)
        {
            string UpUrl = urlString.ToUpper();

            if (!UpUrl.StartsWith("HTTP://"))
                return false;
            return true;
        }

        private static string AddHttp(string urlString)
        {
            urlString = urlString.Insert(0, "HTTP://");
            return urlString;
        }
    }
}
